package com.homework.demo3;

import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;

public class test {
    public static void main(String[] args) {
        Set<Teacher> hashset = new HashSet<>();
        Set<Teacher> treeset = new TreeSet<>(new TeacherComparator());

        hashset.add(new Teacher("张三",30,5000));
        hashset.add(new Teacher("李四",30,6000));
        hashset.add(new Teacher("王五",25,7000));

        treeset.addAll(hashset);

        System.out.println("hashset:"+hashset);
        System.out.println("treeset:"+treeset);


    }
}
